home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MACD 5
/
MACD 5.bin
/
workbench
/
tools
/
czesc_1
/
easyprocess
/
source
/
launch
/
flushprocs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-07
|
1KB
|
64 lines
#include <arpbase.h>
#include <arp_proto.h>
#include "Launch.h"
#include "LaunchPriv.h"
/*
* NAME
* FlushProcesses -- free all children that are dead.
*
* SYNOPSIS
* FlushProcesses ()
*
* void FlushProcesses (void);
*
* DESCRIPTION
* Scan the process pair list and if the parent is te current
* process and the child is dead, it removes the pair and frees
* the memory.
*
* After the scan, we check if the current process is still a
* parent. If not, we free its signal bit.
*
* We then check if the list is empty and free it.
*
* INPUT
* None.
*
* OUTPUT
* None.
*
* HISTORY
* 1992/09/07 Pierre Baillargeon Creation
*/
void FlushProcesses (void)
{
struct ProcPair *pp;
struct Process *Proc;
LONG Bit;
Bit = -1L;
Proc = (struct Process *)FindTask (NULL);
Forbid ();
if (NULL != ProcPairList)
{
for (pp = (struct ProcPair *)ProcPairList->lh_Head; pp->pp_Node.ln_Succ; pp = (struct ProcPair *)pp->pp_Node.ln_Succ)
{
if (Proc == pp->pp_Parent && NULL == pp->pp_ChildEntry)
{
Bit = pp->pp_ParentBit;
Remove (&pp->pp_Node);
FreeMem (pp, sizeof (struct ProcPair));
}
}
}
FreeParentSignal (Bit);
FreeProcPairList ();
Permit ();
}